import java.util.Arrays;

public class Solution1371 {
    public int findTheLongestSubstring(String s) {
        int[] f=new int[32];
        int ans=0;
        Arrays.fill(f,Integer.MAX_VALUE);
        f[0]=-1;
        int a=0,e=0,i=0,o=0,u=0;
        for (int j=0;j<s.length();j++){
            if (s.charAt(j)=='a'){
                a=(a+1)%2;
            }else if (s.charAt(j)=='e'){
                e=(e+1)%2;
            }else if (s.charAt(j)=='i'){
                i=(i+1)%2;
            }else if (s.charAt(j)=='o'){
                o=(o+1)%2;
            }else if (s.charAt(j)=='u'){
                u=(u+1)%2;
            }
            if (f[cal(a,e,i,o,u)]==Integer.MAX_VALUE){
                f[cal(a,e,i,o,u)]=j;
            }else{
                ans=Math.max(ans,j-f[cal(a,e,i,o,u)]);
            }
        }
        return ans;
    }

    private int cal(int a, int e, int i, int o, int u) {
        return a*16+e*8+i*4+o*2+u;
    }

    public static void main(String[] args) {
        System.out.println(new Solution1371().findTheLongestSubstring("leetcodeisgreat"));
    }
}
